﻿/********************************************************
 * Project Name   : VAdvantage
 * Class Name     : MPackageLine
 * Purpose        : Package Line Model
 * Class Used     : X_M_PackageLine
 * Chronological    Development
 * Karan            18-May-2011
  ******************************************************/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VAdvantage.Classes;
using VAdvantage.Common;
using VAdvantage.Process; using VAdvantage.ProcessEngine;
using System.Windows.Forms;
using VAdvantage.Model;
using VAdvantage.DataBase;
using VAdvantage.SqlExec;
using VAdvantage.Utility;
using System.Data;
using VAdvantage.Logging;
using VAdvantage.Model;

namespace VAdvantage.Model
{
    public class MPackageLine : X_M_PackageLine
    {
        /// <summary>
        /// Standard Constructor
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="M_PackageLine_ID">id</param>
        /// <param name="trxName">transaction</param>
        public MPackageLine(Ctx ctx, int M_PackageLine_ID, String trxName)
            : base(ctx, M_PackageLine_ID, trxName)
        {
            if (M_PackageLine_ID == 0)
            {
                //	setM_Package_ID (0);
                //	setM_InOutLine_ID (0);
                SetQty(Envs.ZERO);
            }
        }

        /// <summary>
        /// Load Constructor
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="dr">datarow</param>
        /// <param name="trxName">transaction</param>
        public MPackageLine(Ctx ctx, DataRow dr, String trxName)
            : base(ctx, dr, trxName)
        {

        }

        /// <summary>
        /// Parent Constructor
        /// </summary>
        /// <param name="parent">header</param>
        public MPackageLine(MPackage parent)
            : this(parent.GetCtx(), 0, parent.Get_TrxName())
        {
            SetClientOrg(parent);
            SetM_Package_ID(parent.GetM_Package_ID());
        }

        /// <summary>
        /// Set Shipment Line
        /// </summary>
        /// <param name="line">line</param>
        public void SetInOutLine(MInOutLine line)
        {
            SetM_InOutLine_ID(line.GetM_InOutLine_ID());
            SetQty(line.GetMovementQty());
        }
    }
}
